package com.css.zfzx.sjcj.modules.hddcVolcanicSamplePoint.service.handler;

import cn.afterturn.easypoi.excel.entity.result.ExcelVerifyHandlerResult;
import cn.afterturn.easypoi.handler.inter.IExcelVerifyHandler;
import com.css.bpm.platform.utils.PlatformObjectUtils;
import com.css.zfzx.sjcj.common.excel.util.ActiveFaultEasyExcelVerifyHelper;
import com.css.zfzx.sjcj.modules.hddcVolcanicSamplePoint.viewobjects.HddcVolcanicsamplepointVO;
import org.springframework.stereotype.Component;

/**
 * <p>火山采样点-点 导入校验</p>
 *
 * @author liuhy
 * @date 2021/8/24
 */
@Component
public class VolcanicPoint2PointExcelImportVerifyHandler implements IExcelVerifyHandler<HddcVolcanicsamplepointVO> {

    private final ActiveFaultEasyExcelVerifyHelper helper;

    public VolcanicPoint2PointExcelImportVerifyHandler(ActiveFaultEasyExcelVerifyHelper helper) {
        this.helper = helper;
    }

    @Override
    public ExcelVerifyHandlerResult verifyHandler(HddcVolcanicsamplepointVO vo) {
        ExcelVerifyHandlerResult result = helper.verify(vo);
        if (PlatformObjectUtils.isEmpty(vo.getExtends5())) {
            result.setSuccess(false);
            result.setMsg("经度不能为空");
            return result;
        } else if (PlatformObjectUtils.isEmpty(vo.getExtends6())) {
            result.setSuccess(false);
            result.setMsg("纬度不能为空");
            return result;
        } else if (PlatformObjectUtils.isEmpty(vo.getTown())) {
            result.setSuccess(false);
            result.setMsg("详细地址不能为空");
            return result;
        }
        return result;
    }

}
